﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Tanmia.Core
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
    public sealed class AllowSelectAttribute : ValidationAttribute
    {
        public override bool IsValid(object value)
        {
            if (value == Account.SelectAccount
                || value == Color.SelectColor
                || value == Item.SelectItem
                || value == ItemCategory.SelectItemCategory
                || value == Person.SelectCustomer
                || value == Person.SelectManufacturer
                || value == Person.SelectMerchant
                || value == Repository.SelectRepository
                || value == Unit.SelectUnit)
                return false;

            return true;
        }
    }
}
